package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.UserSessionRelationMapper;
import com.ruoyi.system.domain.UserSessionRelation;
import com.ruoyi.system.service.IUserSessionRelationService;

/**
 * 用户会话关联Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-09-23
 */
@Service
public class UserSessionRelationServiceImpl implements IUserSessionRelationService {
    @Autowired
    private UserSessionRelationMapper userSessionRelationMapper;

    /**
     * 查询用户会话关联
     * 
     * @param id 用户会话关联主键
     * @return 用户会话关联
     */
    @Override
    public UserSessionRelation selectUserSessionRelationById(String id)
    {
        return userSessionRelationMapper.selectUserSessionRelationById(id);
    }

    /**
     * 查询用户会话关联列表
     * 
     * @param userSessionRelation 用户会话关联
     * @return 用户会话关联
     */
    @Override
    public List<UserSessionRelation> selectUserSessionRelationList(UserSessionRelation userSessionRelation)
    {
        return userSessionRelationMapper.selectUserSessionRelationList(userSessionRelation);
    }

    /**
     * 新增用户会话关联
     * 
     * @param userSessionRelation 用户会话关联
     * @return 结果
     */
    @Override
    public int insertUserSessionRelation(UserSessionRelation userSessionRelation) {

        setVOInfo(userSessionRelation);

        userSessionRelation.setCreateTime(DateUtils.getNowDate());
        return userSessionRelationMapper.insertUserSessionRelation(userSessionRelation);
    }

    /**
     * 修改用户会话关联
     * 
     * @param userSessionRelation 用户会话关联
     * @return 结果
     */
    @Override
    public int updateUserSessionRelation(UserSessionRelation userSessionRelation)
    {
        userSessionRelation.setUpdateTime(DateUtils.getNowDate());
        return userSessionRelationMapper.updateUserSessionRelation(userSessionRelation);
    }

    /**
     * 批量删除用户会话关联
     * 
     * @param ids 需要删除的用户会话关联主键
     * @return 结果
     */
    @Override
    public int deleteUserSessionRelationByIds(String[] ids)
    {
        return userSessionRelationMapper.deleteUserSessionRelationByIds(ids);
    }

    /**
     * 删除用户会话关联信息
     * 
     * @param id 用户会话关联主键
     * @return 结果
     */
    @Override
    public int deleteUserSessionRelationById(String id)
    {
        return userSessionRelationMapper.deleteUserSessionRelationById(id);
    }
}
